//
//  WmcPunchCardDayView.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/5/14.
//

import UIKit

class WmcPunchCardDayView: WmcBaseView {
    lazy var backgroundImageView: UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()

    lazy var punchCardDayImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.contentMode = .scaleAspectFit
        return imageView
    }()
    
    lazy var dayLabel: UILabel = {
        let label = UILabel.YP.Create(alignment: .center)
        return label
    }()

    override func makeUI() {
        addSubview(backgroundImageView)
        backgroundImageView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        addSubview(punchCardDayImageView)
        punchCardDayImageView.snp.makeConstraints { make in
            make.top.equalTo(13)
            make.height.equalTo(36)
            make.left.right.equalToSuperview()
        }
        
        addSubview(dayLabel)
        dayLabel.snp.makeConstraints { make in
            make.left.right.equalToSuperview()
            make.top.equalTo(punchCardDayImageView.snp.bottom).offset(2)
            make.height.equalTo(18)
        }
    }

    func setSelect(_ isSelect: Bool) {
        if isSelect {
            backgroundImageView.image = "business_day_background".wmc_image
                .yp.set(tintColor: UIColor.wmc_mainTheme.yp.alpha(0.15))
            punchCardDayImageView.image = "business_punch_se".wmc_image
            dayLabel.font = 14.yp.uiFont(weight: .medium)
            dayLabel.textColor = .wmc_mainTheme
        } else {
            backgroundImageView.image = "business_day_background".wmc_image
            punchCardDayImageView.image = "business_punch_no".wmc_image
            dayLabel.font = 14.wmc_font
            dayLabel.textColor = .wmc_grayH2_323233
        }
    }
}
